import { _decorator, Component } from 'cc';
import { Player } from '../../player/script/Player';
import { Global } from '../../../script/Global';
import SUI from 'db://assets/sgame/ui/SUI';
import { SceneManager } from 'db://assets/script/scene/SceneManager';
const { ccclass, property } = _decorator;

@ccclass('HallScene')
export class HallScene extends Component {

    start() {
        let me: Player = Global.me;
        this.node.LabelChild("name", me.name);
        this.node.LabelChild("coin", me.coinString);

        this.node.OnClickChild("create", () => {
            SUI.InitWindow("hall/prefabs/createPanel", this.node);
        });

        this.node.OnClickChild("enter", () => {
            SUI.InitWindow("hall/prefabs/enterPanel", this.node);
        });

        if (me.roomId) {
            // TODO:后续考虑怎么优化
            SceneManager.instance().enter("wzq");
        }
    }
}
